<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 

<h:head></h:head> 
<body> 
	<h:form>  
	    <p:panel header="FUNCIONÁRIOS">  
	        <h:panelGrid columns="2" cellpadding="4">  
	            <h:outputText value="Nome: " />  
	            <p:inputText value="#{funcionarioMB.funcionario.nome}"  size="40" />
	              
	            <h:outputText value="Data de nascimento: " />  
				<p:calendar value="#{funcionarioMB.funcionario.dtNascimento}" showButtonPanel="true" pattern="dd/MM/yyyy" size="14" />

	            <h:outputText value="CPF: " />  
	            <p:inputText value="#{funcionarioMB.funcionario.cpf}" size="20" />

	            <h:outputText value="Cargo: " />  
	            <p:inputText value="#{funcionarioMB.funcionario.cargo}" size="20"/>

	        </h:panelGrid>	 

			<p:commandButton value="Gravar" action="#{funcionarioMB.gravarFuncionario}" onclick="notificacao.show()" />
			<p:commandButton value="Pesquisar" action="#{funcionarioMB.pesquisarFuncionario}" onclick="notificacao.show()" />  
            <p:commandButton value="Limpar" type="reset" />
            
            <p:notificationBar position="top" effect="slide" widgetVar="notificacao" styleClass="top">  
			    <h:outputText value="Ação executada com sucesso!" style="color:#FFCC00;font-size:36px;" />  
			</p:notificationBar>  
            
        </p:panel>
            
	    <p:panel>
	    
	    	<p:dataTable value="#{funcionarioMB.listaDeFuncionarios}" var="func">
	    		<p:column>
	    			<f:facet name="header">Nome</f:facet>
	    			<h:outputText value="#{func.nome}" />
	    		</p:column>
	    		
	    		<p:column colspan="2" headerText="Ações" value="Alterar" style="width:130px">  
	                <p:commandLink value="Alterar" action="#{funcionarioMB.alterarFuncionario}">
	                	<f:param value="#{func.id}" name="idFuncionario" />
	                </p:commandLink>&nbsp;&nbsp;

	                <p:commandLink value="Excluir" action="#{funcionarioMB.excluirFuncionario}">
	                	<f:param value="#{func.id}" name="idFuncionario" />
	                </p:commandLink>&nbsp;&nbsp;
	                
       	        </p:column>  
	    			    	
	    	</p:dataTable>	    
	    </p:panel>
    </h:form>
</body> 
</html>
 